

package org.koyabr.webx.demo.danmaku.web.post.module.screen;

import com.alibaba.citrus.turbine.dataresolver.Param;
import com.alibaba.citrus.turbine.Context;
import org.koyabr.webx.demo.danmaku.biz.UserManager;
import org.koyabr.webx.demo.danmaku.biz.PostManager;
import org.koyabr.webx.demo.danmaku.dal.dataobjs.User;
import org.koyabr.webx.demo.danmaku.dal.dataobjs.Post;
import org.koyabr.webx.demo.danmaku.web.common.DanmakuUser;
import org.springframework.beans.factory.annotation.Autowired;

public class Detail {
    @Autowired
    private UserManager userManager;
    
    @Autowired
    private PostManager postManager;

    public void execute(@Param("id") String postId,  Context context) throws Exception {
    	
    	//放入目标文章
    	Post post = postManager.getPostById(postId);
    	context.put("post", post);
    	
    	// 放入当前用户
        User user = userManager.getUser(DanmakuUser.getCurrentUser().getUsername());
        context.put("user", user);
        
        
    }
}
